
/*
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include <stdio.h>

#include "libmooigraph.h"
#include "lmg.h"

void
lmg_inout (void)
{
  struct lmgnodel *nptr;
  struct lmgedgel *eptr;
  struct lmgedge *e;
  struct lmgnode *fn;
  struct lmgnode *tn;
  struct lmgedgel *el;
  eptr = lmgedgelist;
  while (eptr)
    {
      e = eptr->edge;
      fn = e->from;
      tn = e->to;
      fn->bitflags.hasout = 1;
      tn->bitflags.hasin = 1;
      el = lmg_malloc (sizeof (struct lmgedgel));
      el->edge = e;
      if (fn->poe)
	{
	  fn->poeend->next = el;
	  fn->poeend = el;
	}
      else
	{
	  fn->poe = el;
	  fn->poeend = el;
	}
      el = lmg_malloc (sizeof (struct lmgedgel));
      el->edge = e;
      if (tn->poe)
	{
	  tn->poeend->next = el;
	  tn->poeend = el;
	}
      else
	{
	  tn->poe = el;
	  tn->poeend = el;
	}
      eptr = eptr->next;
    }
  lmgnsingles = 0;
  nptr = lmgnodelist;
  while (nptr)
    {
      if (nptr->node->bitflags.hasout == 0 && nptr->node->bitflags.hasin == 0)
	{
	  lmgnsingles = lmgnsingles + 1;
	}
      nptr = nptr->next;
    }
  return;
}

/* End */
